home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / ungetc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  368 b   |  24 lines

  1.  
  2. /* unget one */
  3.  
  4. #include "std-guts.h"
  5.  
  6. void ungetc(c, f)
  7. int c;
  8. struct file * f;
  9. {
  10. #ifdef DEBUG
  11.   char buf[32];
  12.  
  13.   sprintf(buf, " <'%c'", c);
  14.   dbgstr(buf);
  15. #endif
  16. /* should probly do some error checking in here... */
  17.   if (c != EOF)        /* trying to ungetc an EOF is a no-op */
  18.     {
  19.     f->buf_index--;
  20.     f->buf[f->buf_index] = c;
  21.     f->eof_p = 0;
  22.     }
  23. }
  24.